return $res->code;
}
-sub teapot {
- print "\nThis server is a teapot.\n";
- print "As per RFC 2324 section 2.3.2: This server is a teapot and refuses to brew coffee.\n";
- print "It may brew tea instead, but coffee is beyond its capabilities.\n";
-}
-
# curl -X behaviour: sends request with specified method, returns body
sub request_body {
my ($method, $url) = @_;
return $res->content;
}
+sub teapot {
+ print "\nThis server is a teapot.\n";
+ print "As per RFC 2324 section 2.3.2: This server is a teapot and refuses to brew coffee.\n";
+ print "It may brew tea instead, but coffee is beyond its capabilities.\n";
+}
+
# find webmaster email in page body
sub find_webmaster_email {
my ($url) = @_;
}
}
-sub print_response {
- my ($method, $url) = @_;
-
- my $ua = LWP::UserAgent->new(max_redirect => 0, timeout => 10);
- my $req = HTTP::Request->new(uc($method) => $url);
- my $res = $ua->request($req);
-
- # print "Status : " . $res->status_line . "\n";
- # print "Headers:\n" . $res->headers->as_string . "\n";
- print $res->content . "\n" if $res->content;
-}
-
## meat
# get the domain
# decision tree
if ($http_brew == 200) {
- print_response('BREW', $http_domain);
+ print request_body('BREW', $http_domain);print "\n";
good_manners('http');
} elsif ($https_brew == 200) {
- print_response('BREW', $https_domain);
+ print request_body('BREW', $https_domain);print "\n";
good_manners('https');
} elsif ($http_brew == 418 || $https_brew == 418) {
teapot();